<{include file="../common/header.tpl"}>
<script type="text/javascript" src='/js/datepicker/WdatePicker.js'></script>
<table width="100%" border="0" cellspacing="0">
 <tr>
       <td width="13%" valign="top">
           <{include file="../common/left.tpl"}>
       </td>
       <td width="87%" valign="top">

               <table width="100%" border="0" cellspacing="0">
                 <tr>
                    <td>
                        <div class="subnav">
                          <div class="content-menu ib-a blue line-x"> <a href="javascript:void(0);" class="on"><em><{if $info}>编辑项目<{else}>添加项目<{/if}></em></a></div>
                        </div>
                        <div class="pad_10">
                          <div class="table-list">
                                <div class="common-form">
                                    <form name="myform" id="myform" action="<{if $info}>/webadmin/project/doEdit<{else}>/webadmin/project/doAdd<{/if}>" method="post" id="myform">
                                    <table width="100%" class="table_form contentWrap">
                                    <tbody>
                                    <tr>
                                        <td width="80">项目编号</td> 
                                        <td colspan="3"><input type="text" name="project_num" id="project_num" value="<{$info.project_num}>" class="input-text" ></td>
                                    </tr>
                                    <tr>
                                        <td width="80">项目名称</td> 
                                        <td colspan="3"><input type="text" name="project_name" id="project_name" value="<{$info.project_name}>" class="input-text"></td>
                                    </tr>
                                    <tr>
                                        <td width="80">通知邮箱</td> 
                                        <td colspan="3"><input type="text" name="email" id="email" value="<{$info.email}>" class="input-text">(超大附件联系邮箱)</td>
                                    </tr>
                                    <tr>
                                        <td width="80">项目所有者</td>
                                        <td colspan="3">
                                            <select name="up_network_id" id="bank_id" onchange="getnetwork(this.value);">
                                                <option>==请选择总行==</option>
                                                <{foreach $network_level_one as $key => $val}>
                                                <option value="<{$key}>" <{if $info.up_network_id==$key}>selected="selected"<{/if}>><{$val}></option>
                                                <{/foreach}>
                                            </select>
                                            <select name="network_id" id="network_id">
                                                <option value="0">==请选择分行==</option>
                                            </select>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="80">项目启动时间</td> 
                                        <td colspan="3">
                                            <input type="text" name="start_time" id="d4311" value="<{$info.start_time}>" class="input-text" onClick="WdatePicker()"  id="start_time">
                                        项目结束时间
                                        <input type="text" name="end_time" id="d4312" value="<{$info.end_time}>" class="input-text" onClick="WdatePicker({minDate:'#F{$dp.$D(\'d4311\')}'})"  id="end_time">
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="80">调查范围</td>
                                        <td width="100">
                                            <textarea name="scope" id="scope" rows="5" cols="60"><{$info.scope}></textarea>
                                        </td>
                                        <td width="80">调查方法</td>
                                        <td>
                                            <textarea name="method" id="method"  rows="5" cols="60"><{$info.method}></textarea>
                                        </td>
                                    </tr>
                                    <tr>
                                      <td>项目背景</td>
                                      <td colspan="3"><textarea name="background" id="background" rows="5" cols="60"><{$info.background}></textarea></td>
                                     </tr>
                                    <tr>
                                        <td bgcolor="#F9F9F9">分配管理员 </td>
                                        <td colspan="3"><table width="100%" border="0" cellspacing="0">
                                                <{foreach $group_list as $key => $val}>
                                                <tr>
                                                  <td bgcolor="#F9F9F9"><strong><{$val.group_name}></strong></td>
                                                </tr>
                                                <{if $val.user}>
                                                <tr>
                                                    <td>
                                                      <{foreach $val.user as $k => $v}>
                                                      <input name="user_id[]" type="checkbox" value="<{$v.user_id}>" <{if $user_list}><{if $v.user_id|in_array:$user_list}>checked="checked"<{/if}><{/if}>><{$v.truename}>
                                                      <{/foreach}>
                                                    </td>
                                                </tr>
                                                <{/if}>
                                                <{/foreach}>
                                            </table>
                                        </td>
                                    </tr>
                                    </tbody>
                                    </table>
                                    <div class="bk15"></div>
                                    <input name="project_id" type="hidden" value="<{$info.project_id}>"/>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <input name="dosubmit" type="submit" value="提交" class="button">
                                    </form>
                                    </div>
                          </div>
                        </div>

                    </td>
                 </tr>
               </table>
       </td>
 </tr>
</table>
<script type="text/javascript">
    $(function(){
        $('#project_num').blur(function(){
            var project_num = $(this).val();
            if (project_num != '') {
                $.getJSON('/webadmin/project/Check',{project_num:project_num,project_id:<{$info.project_id|intval}>},function(res){
                    if (res.status==1) {
                        alert(res.note);
                        $(this).focus();
                    }
                });
            }
        });
        $('#project_name').blur(function(){
            var project_name = $(this).val();
            if (project_name != '') {
                $.getJSON('/webadmin/project/Check',{project_name:project_name,project_id:<{$info.project_id|intval}>},function(res){
                    if (res.status==1) {
                        alert(res.note);
                        $(this).focus();
                    }
                });
            }
        });
    })
    var up_network_id = $('#bank_id').val();
    if (up_network_id) {
        getnetwork(up_network_id);
    }
    function getnetwork(up_network_id){
        $.getJSON('/webadmin/network/getnet',{up_network_id:up_network_id}, function(res){
            var html = '<option value="0">==请选择分行==</option>';
            if (res.status == 1) {
                $.each(res.data, function(i, v){
                    if (<{$info.network_id|intval}> && <{$info.network_id|intval}>==i) {
                        html += '<option value="'+i+'" selected="selected">'+v+'</option>'
                    } else {
                        html += '<option value="'+i+'">'+v+'</option>'
                    }
                    
                });
                $('#network_id').html(html);
            }
        });
    }
    $('#myform').submit(function(){
        var bank_id = $('#bank_id').val();
        if (!bank_id) {
            alert('项目所属行必须选择一项');
            return false;
        }
        var project_num = $('#project_num').val();
        if (project_num=='') {
            alert('项目编号不能为空');
            $('#project_num').focus();
            return false;
        }
        var email = $('#email').val();
        var email_reg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[-|_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
        if (email!='' && !email_reg.test(email)) {
            alert('通知邮箱不能为空');
            $('#email').focus();
            return false;
        }
        var project_name = $('#project_name').val();
        if (project_name=='') {
            alert('项目名称不能为空');
            $('#project_name').focus();
            return false;
        }
        var d4311 = $('#d4311').val();
        var d4312 = $('#d4312').val();
        if (d4311 == '') {
            alert('开始时间不能为空');
            return false;
        }
        if (d4312 == '') {
            alert('结束时间不能为空');
            return false;
        }
        return true;
    });
</script>
<{include file="../common/footer.tpl"}>